import Taro from '@tarojs/taro';
import { Image, Text, View } from '@tarojs/components';
import { AtButton } from 'taro-ui';
import React, { useEffect, useMemo, useState } from 'react';
import './index.less';
interface UserSearchProps {
  gotoDetail: (item: any, name: string) => void;
  data: any;
}

export const UserSearch: React.FC<UserSearchProps> = ({ gotoDetail, data }) => {
  console.log('===userdata', data);
  const getImageSrc = useMemo(() => {
    switch (data.tag) {
      case '品牌方':
        return require('../../assert/imgs/user/pinpai.png');
      case '大咖':
        return require('../../assert/imgs/user/daka.png');
      case '雪茄吧':
        return require('../../assert/imgs/user/xuejiaba.png');
      case '侍咖师':
        return require('../../assert/imgs/user/shikashi.png');
      default: // 包括 null 的情况
        return null;
    }
  }, [data]);
  return (
    // <View className="user-center-head">
    //   <View className="user-center-head-left">
    //     <View className="user-center-name">
    //       {title}
    //       <Image
    //         className="brand-icon"
    //         src={
    //           'https://file.linkcook.cn/image/wineMiniProgram/home/brand.png'
    //         }
    //       />
    //       <Text className="brand-name">高希霸品牌</Text>
    //     </View>
    //     <View className="user-center-account">账号：{account}</View>
    //     <View className="user-center-account">IP属地：{ip}</View>
    //   </View>
    //   <View className="user-center-head-right" onClick={onExit}>
    //     <Image
    //       src={
    //         'https://file.linkcook.cn/image/wineMiniProgram/home/portrait.png'
    //       }
    //     />
    //   </View>
    // </View>
    <View
      className="user-center-search-head"
      onClick={() => gotoDetail(data, 'userCenter')}
    >
      <View className="user-center-search-head-left">
        <View className="user-center-search-name">
          {data.ucNickname}
          <Image className="brand-icon" src={getImageSrc} />
          <View className="user-center-search-name-kind">{data.brand}</View>
        </View>
        <View className="user-center-search-account-number">
          账号：{data.ucUserId}
        </View>
        <View className="user-center-search-account">
          IP属地：{data.address}
        </View>
      </View>
      {/* <View className="user-center-search-head-right"> */}
      <Image className="user-center-search-head-right" src={data.ucAvatarUrl} />
      {/* // </View> */}
    </View>
  );
};
